<template>
  <el-row class="panel-group">
    <el-row :gutter="20">
      <el-col :span="4" class="card-panel-col">
        <div class="card-panel" style="border-radius: 10px 10px 10px 10px;">
          <div class="card-panel-description">
            <div class="card-panel-text">
              本项目加班次数
            </div>
            <count-to :start-val="0" :end-val="data.theCount" :duration="3600" class="card-panel-num" />
          </div>
        </div>
      </el-col>
      <el-col :span="4" class="card-panel-col">
        <div class="card-panel" style="border-radius: 10px 10px 10px 10px;">
          <div class="card-panel-description">
            <div class="card-panel-text">
              本项目加班时长
            </div>
            <count-to :start-val="0" :end-val="data.theDuration" :duration="3600" class="card-panel-num" />
          </div>
        </div>
      </el-col>
      <el-col :span="4" class="card-panel-col">
        <div class="card-panel" style="border-radius: 10px 10px 10px 10px;">
          <div class="card-panel-description">
            <div class="card-panel-text">
              外出加班次数
            </div>
            <count-to :start-val="0" :end-val="data.outCount" :duration="3600" class="card-panel-num" />
          </div>
        </div>
      </el-col>
      <el-col :span="4" class="card-panel-col">
        <div class="card-panel" style="border-radius: 10px 10px 10px 10px;">
          <div class="card-panel-description">
            <div class="card-panel-text">
              外出加班时长
            </div>
            <count-to :start-val="0" :end-val="data.outDuration" :duration="3600" class="card-panel-num" />
          </div>
        </div>
      </el-col>
      <el-col :span="4" class="card-panel-col">
        <div class="card-panel" style="border-radius: 10px 10px 10px 10px;">
          <div class="card-panel-description">
            <div class="card-panel-text">
              工程加班次数
            </div>
            <count-to :start-val="0" :end-val="data.gcCount" :duration="3600" class="card-panel-num" />
          </div>
        </div>
      </el-col>
      <el-col :span="4" class="card-panel-col">
        <div class="card-panel" style="border-radius: 10px 10px 10px 10px;">
          <div class="card-panel-description">
            <div class="card-panel-text">
              工程加班时长
            </div>
            <count-to :start-val="0" :end-val="data.gcDuration" :duration="3600" class="card-panel-num" />
          </div>
        </div>
      </el-col>
    </el-row>
  </el-row>
</template>

<script>
import CountTo from 'vue-count-to'
import { selectOvertimeAnalyze } from "@/api/cld/overtime";
export default {
  components: {
    CountTo
  },
  props: {
    month: {
      type: Number
    }
  },
  data() {
    return {
      data: {}
    }
  },
  created() {
    this.getInfo()
  },
  methods: {
    getInfo() {
      selectOvertimeAnalyze().then(res => {
        this.data = res.data;
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.panel-group {
  .card-panel-col {
    margin-bottom: 10px;
  }

  .card-panel {
    height: 108px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    border-color: rgba(0, 0, 0, .05);
    box-shadow: 5px 5px 5px #DCDFE6;
    border:1px #DCDFE6 solid;
    margin-bottom: 10px;

    &:hover {
      .card-panel-icon-wrapper {
        color: #fff;
      }

      .icon-people {
        background: #40c9c6;
      }

      .icon-message {
        background: #36a3f7;
      }

      .icon-money {
        background: #f4516c;
      }

      .icon-shopping {
        background: #34bfa3
      }
    }

    .icon-people {
      color: #40c9c6;
    }

    .icon-message {
      color: #36a3f7;
    }

    .icon-money {
      color: #f4516c;
    }

    .icon-shopping {
      color: #34bfa3
    }

    .card-panel-icon-wrapper {
      float: left;
      margin: 14px 0 0 14px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }

    .card-panel-icon {
      float: left;
      font-size: 48px;
    }

    .card-panel-description {
      font-weight: bold;
      margin: 26px;

      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }

      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}

@media (max-width:550px) {
  .card-panel-description {
    display: none;
  }

  .card-panel-icon-wrapper {
    float: none !important;
    width: 100%;
    height: 100%;
    margin: 0 !important;

    .svg-icon {
      display: block;
      margin: 14px auto !important;
      float: none !important;
    }
  }
}
</style>
